home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / phillip2 / mymsc.c < prev    next >
C/C++ Source or Header  |  1993-06-11  |  4KB  |  255 lines

  1.  
  2.     /***********************************************
  3.     *
  4.     *  file d:\cips\mymsc.c
  5.     *
  6.     *  Functions: This file contains
  7.     *     my_clearscreen
  8.     *     my_setvideomode
  9.     *     my_setlinestyle
  10.     *     my_setcolor
  11.     *     my_setpixel
  12.     *     my_moveto
  13.     *     my_lineto
  14.     *     my_settextcolor
  15.     *     my_setbkcolor
  16.     *     my_settextposition
  17.     *     my_outtext
  18.     *     my_remappalette
  19.     *     my_map_64_shades_of_gray
  20.     *
  21.     *  Purpose:
  22.     *     This file contains subroutines that 
  23.     *     call Microsoft C 6.0 specific 
  24.     *     routines.  I put them all here in one
  25.     *     file to make it easier to port the
  26.     *     C Image Processing System software
  27.     *     to other C compilers and non-IBM PC
  28.     *     computers.
  29.     *     
  30.     *     Each subroutine in this file is a "wrapper"
  31.     *     for a Microsoft C 6.0 routine.  I put
  32.     *     the letters "my" in front of the Microsoft
  33.     *     routine name.  For example, my_clearscreen
  34.     *     calls Microsoft's _clearscreen.
  35.     *     
  36.     *     The one exception is 
  37.     *     my_map_64_shades_of_gray.
  38.     *
  39.     *  External Calls: all MSC calls
  40.     *     _clearscreen
  41.     *     _setvideomode
  42.     *     _setlinestyle
  43.     *     _setcolor
  44.     *     _setpixel
  45.     *     _moveto
  46.     *     _lineto
  47.     *     _settextcolor
  48.     *     _setbkcolor
  49.     *     _settextposition
  50.     *     _outtext
  51.     *     _remappalette
  52.     *
  53.     *  Modifications:
  54.     *     5 June 1993 - created
  55.     *
  56.     *************************************************/
  57.  
  58. #include "cips.h"
  59.  
  60.  
  61.  
  62.    /***********************************
  63.     *
  64.     *   This ifdef makes all the MSC
  65.     *   calls work.  The MSC variable
  66.     *   must be defined in cips.h.
  67.     *
  68.     ************************************/
  69.  
  70. #ifdef MSC
  71.  
  72.  
  73.  
  74. my_clearscreen()
  75. {
  76.    _clearscreen(_GCLEARSCREEN);
  77. }
  78.  
  79. my_lineto(x, y)
  80.    short x, y;
  81. {
  82.    _lineto(x, y);
  83. }
  84.  
  85. my_moveto(x, y)
  86.    short x, y;
  87. {
  88.    _moveto(x, y);
  89. }
  90.  
  91. my_outtext(text)
  92.    char *text;
  93. {
  94.    _outtext(text);
  95. }
  96.  
  97. my_remappalette(index, color)
  98.    short index;
  99.    long  color;
  100. {
  101.    _remappalette(index, color);
  102. }
  103.  
  104. my_setbkcolor(color)
  105.    long color;
  106. {
  107.    _setbkcolor(color);
  108. }
  109.  
  110. my_setcolor(color)
  111.    short color;
  112. {
  113.    _setcolor(color);
  114. }
  115.  
  116. my_setlinestyle(mode)
  117.    unsigned short mode;
  118. {
  119.    _setlinestyle(mode);
  120. }
  121.  
  122. my_setpixel(x, y)
  123.    short x, y;
  124. {
  125.    _setpixel(x, y);
  126. }
  127.  
  128. my_settextcolor(index)
  129.    short index;
  130. {
  131.    _settextcolor(index);
  132. }
  133.  
  134. my_settextposition(row, column)
  135.    short row, column;
  136. {
  137.    _settextposition(row, column);
  138. }
  139.  
  140. my_setvideomode(mode)
  141.    short mode;
  142. {
  143.    _setvideomode(mode);
  144. }
  145.  
  146.  
  147. my_map_64_shades_of_gray()
  148. {
  149.    map_64_shades_of_gray();
  150. }
  151.  
  152.  
  153.  
  154.    /*******************************************
  155.    *
  156.    *   map_64_shades_of_gray()
  157.    *
  158.    *   This function maps 256 DAC registers to
  159.    *   gray shades.  Taken from p. 73 of
  160.    *   Sutty and Blair's text on superVGA
  161.    *
  162.    ********************************************/
  163.  
  164.  
  165. map_64_shades_of_gray()
  166. {
  167.  
  168.    _asm{
  169.       mov ax,0013h ;mod 13h is 320x200x256
  170.       int 10h
  171.  
  172.       mov ah,10h   ; function 10h
  173.       mov al,1bh   ; sub function 1bh
  174.       mov bx,0h    ; first DAC register to change
  175.       mov cx,100h  ; change 256 DAC registers
  176.       int 10h
  177.  
  178.    } /* ends asm */
  179. }  /* ends map_64_shades_of_gray */
  180.  
  181. #endif /* ends ifdef MSC */
  182.  
  183.  
  184.  
  185.  
  186. #ifdef OTHERC
  187.  
  188.  
  189. my_clearscreen()
  190. {
  191. }
  192.  
  193. my_lineto(x, y)
  194.    short x, y;
  195. {
  196. }
  197.  
  198. my_moveto(x, y)
  199.    short x, y;
  200. {
  201. }
  202.  
  203. my_outtext(text)
  204.    char *text;
  205. {
  206. }
  207.  
  208. my_remappalette(index, color)
  209.    short index;
  210.    long  color;
  211. {
  212. }
  213.  
  214. my_setbkcolor(color)
  215.    long color;
  216. {
  217. }
  218.  
  219. my_setcolor(color)
  220.    short color;
  221. {
  222. }
  223.  
  224. my_setlinestyle(mode)
  225.    unsigned short mode;
  226. {
  227. }
  228.  
  229. my_setpixel(x, y)
  230.    short x, y;
  231. {
  232. }
  233.  
  234. my_settextcolor(index)
  235.    short index;
  236. {
  237. }
  238.  
  239. my_settextposition(row, column)
  240.    short row, column;
  241. {
  242. }
  243.  
  244. my_setvideomode(mode)
  245.    short mode;
  246. {
  247. }
  248.  
  249.  
  250. my_map_64_shades_of_gray()
  251. {
  252. }
  253.  
  254. #endif /* ends ifdef OTHER C */
  255.